<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller{
	function index(){
		$this->display();
	}
	function check(){
		//验证验证码是否正确
		$verify=new \Think\Verify();
		if(!$verify-check($_POST['code'])){
            $this->error("验证码错误",U("Admin/Login/index"));
            exit();
		}
		if($_POST['username']=='' && $_POST['password']==''){
            //创建会话变量
            setcookie("adminid",1,0,'/');
            setcookie('username','',0,'/');
            $this->redirect("Admin/Index/index");
		}else{
			$this->redirect("Admin/Login/index");
		}
	}
}